package com.prs.crm.action.sys;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.courser.struts.BaseAction;
import org.courser.ui.PaginationSupport;
import org.hibernate.criterion.DetachedCriteria;

import com.prs.crm.domain.sys.LeadEmailAnonymity;
import com.prs.crm.service.sys.LeadEmailAnonymityService;

public class LeadEmailAnonymityAction extends BaseAction{

	private static final long serialVersionUID = 1L;
	private LeadEmailAnonymity leadEmailAnonymity;
	private LeadEmailAnonymityService leadEmailAnonymityService;
	private PaginationSupport pagination;
	public LeadEmailAnonymity getLeadEmailAnonymity() {
		return leadEmailAnonymity;
	}
	public void setLeadEmailAnonymity(LeadEmailAnonymity leadEmailAnonymity) {
		this.leadEmailAnonymity = leadEmailAnonymity;
	}
	public LeadEmailAnonymityService getLeadEmailAnonymityService() {
		return leadEmailAnonymityService;
	}
	public void setLeadEmailAnonymityService(
			LeadEmailAnonymityService leadEmailAnonymityService) {
		this.leadEmailAnonymityService = leadEmailAnonymityService;
	}
	public PaginationSupport getPagination() {
		return pagination;
	}
	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}
	
	@Action("listLeadEmailAnonymity")
	public String listLeadEmailAnonymity(){
		DetachedCriteria criteria =this.getPaginationHelper().createQuery(LeadEmailAnonymity.class);
		pagination=this.getPaginationHelper().prepare(pagination);
		this.setPagination(this.getLeadEmailAnonymityService().listByPage(criteria, pagination));
		return SUCCESS;
	}
	@Action(value = "saveLeadEmailAnonymity", results = {
			@Result(name = "success", type = "redirect", location = "listLeadEmailAnonymity"),
			@Result(name = "error", type = "chain", location = "listLeadEmailAnonymity")})
	public String saveLeadEmailAnonymity(){
		leadEmailAnonymity.setState(0);
		this.getLeadEmailAnonymityService().submit(leadEmailAnonymity);
		return SUCCESS;
	}
	@Action(value = "saveLeadEmailAnonymitys", results = {
			@Result(name = "success", type = "redirect", location = "listLeadEmailAnonymity"),
			@Result(name = "error", type = "chain", location = "listLeadEmailAnonymity")})
	public String saveLeadEmailAnonymitys(){
		leadEmailAnonymity.setState(1);
		this.getLeadEmailAnonymityService().submit(leadEmailAnonymity);
		return SUCCESS;
	}
}
